home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 319 / compsrc1 / emit-rtl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  37.5 KB  |  1,471 lines

  1. /* Emit RTL for the GNU C-Compiler expander.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY.  No author or distributor
  8. accepts responsibility to anyone for the consequences of using it
  9. or for whether it serves any particular purpose or works at all,
  10. unless he says so in writing.  Refer to the GNU CC General Public
  11. License for full details.
  12.  
  13. Everyone is granted permission to copy, modify and redistribute
  14. GNU CC, but only under the conditions described in the
  15. GNU CC General Public License.   A copy of this license is
  16. supposed to have been given to you along with GNU CC so you
  17. can know your rights and responsibilities.  It should be in a
  18. file named COPYING.  Among other things, the copyright notice
  19. and this notice must be preserved on all copies.  */
  20.  
  21.  
  22. /* Middle-to-low level generation of rtx code and insns.
  23.  
  24.    This file contains the functions `gen_rtx', `gen_reg_rtx'
  25.    and `gen_label_rtx' that are the usual ways of creating rtl
  26.    expressions for most purposes.
  27.  
  28.    It also has the functions for creating insns and linking
  29.    them in the doubly-linked chain.
  30.  
  31.    The patterns of the insns are created by machine-dependent
  32.    routines in insn-emit.c, which is generated automatically from
  33.    the machine description.  These routines use `gen_rtx' to make
  34.    the individual rtx's of the pattern; what is machine dependent
  35.    is the kind of rtx's they make and what arguments they use.  */
  36.  
  37. #include "config.h"
  38. #include <stdio.h>
  39. #include "varargs.h"
  40. #include "rtl.h"
  41. #include "regs.h"
  42. #include "insn-config.h"
  43.  
  44. #define max(A,B) ((A) > (B) ? (A) : (B))
  45. #define min(A,B) ((A) < (B) ? (A) : (B))
  46.  
  47. /* This is reset to FIRST_PSEUDO_REGISTER at the start each function.
  48.    After rtl generation, it is 1 plus the largest register number used.  */
  49.  
  50. int reg_rtx_no = FIRST_PSEUDO_REGISTER;
  51.  
  52. /* This is *not* reset after each function.  It gives each CODE_LABEL
  53.    in the entire compilation a unique label number.  */
  54.  
  55. static int label_num = 1;
  56.  
  57. /* Value of `label_num' at start of current function.  */
  58.  
  59. static int first_label_num;
  60.  
  61. /* Nonzero means do not generate NOTEs for source line numbers.  */
  62.  
  63. static int no_line_numbers;
  64.  
  65. /* Commonly used rtx's, so that we only need space for one copy.
  66.    These are initialized once for the entire compilation.
  67.    All of these except perhaps fconst0_rtx and dconst0_rtx
  68.    are unique; no other rtx-object will be equal to any of these.  */
  69.  
  70. rtx pc_rtx;            /* (PC) */
  71. rtx cc0_rtx;            /* (CC0) */
  72. rtx cc1_rtx;            /* (CC1) (not actually used nowadays) */
  73. rtx const0_rtx;            /* (CONST_INT 0) */
  74. rtx const1_rtx;            /* (CONST_INT 1) */
  75. rtx fconst0_rtx;        /* (CONST_DOUBLE:SF 0) */
  76. rtx dconst0_rtx;        /* (CONST_DOUBLE:DF 0) */
  77.  
  78. /* All references to the following fixed hard registers go through
  79.    these unique rtl objects.  On machines where the frame-pointer and
  80.    arg-pointer are the same register, they use the same unique object.
  81.  
  82.    After register allocation, other rtl objects which used to be pseudo-regs
  83.    may be clobbered to refer to the frame-pointer register.
  84.    But references that were originally to the frame-pointer can be
  85.    distinguished from the others because they contain frame_pointer_rtx.
  86.  
  87.    In an inline procedure, the stack and frame pointer rtxs may not be
  88.    used for anything else.  */
  89. rtx stack_pointer_rtx;        /* (REG:Pmode STACK_POINTER_REGNUM) */
  90. rtx frame_pointer_rtx;        /* (REG:Pmode FRAME_POINTER_REGNUM) */
  91. rtx arg_pointer_rtx;        /* (REG:Pmode ARG_POINTER_REGNUM) */
  92. rtx struct_value_rtx;        /* (REG:Pmode STRUCT_VALUE_REGNUM) */
  93. rtx struct_value_incoming_rtx;    /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */
  94. rtx static_chain_rtx;        /* (REG:Pmode STATIC_CHAIN_REGNUM) */
  95. rtx static_chain_incoming_rtx;    /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */
  96.  
  97. /* The ends of the doubly-linked chain of rtl for the current function.
  98.    Both are reset to null at the start of rtl generation for the function.  */
  99.  
  100. static rtx first_insn = NULL;
  101. static rtx last_insn = NULL;
  102.  
  103. /* The ends of a similar chain of rtl insns to become part
  104.    of the SEQUENCE returned by a gen_... function (in insn-emit.c).
  105.    This allows define_expand to use subroutines that call emit_insn.  */
  106. static rtx sequence_first_insn = NULL;
  107. static rtx sequence_last_insn = NULL;
  108.  
  109. /* Nonzero if emit_insn should add to the sequence_first_insn chain
  110.    instead of the ordinary chain.  */
  111. int emit_to_sequence;
  112.  
  113. /* INSN_UID for next insn emitted.
  114.    Reset to 1 for each function compiled.  */
  115.  
  116. static int cur_insn_uid = 1;
  117.  
  118. /* Line number and source file of the last line-number NOTE emitted.
  119.    This is used to avoid generating duplicates.  */
  120.  
  121. static int last_linenum = 0;
  122. static char *last_filename = 0;
  123.  
  124. /* A vector indexed by pseudo reg number.  The allocated length
  125.    of this vector is regno_pointer_flag_length.  Since this
  126.    vector is needed during the expansion phase when the total
  127.    number of registers in the function is not yet known,
  128.    it is copied and made bigger when necessary.  */
  129.  
  130. char *regno_pointer_flag;
  131. int regno_pointer_flag_length;
  132.  
  133. /* Indexed by pseudo register number, gives the rtx for that pseudo.
  134.    Allocated in parallel with regno_pointer_flag.  */
  135.  
  136. rtx *regno_reg_rtx;
  137.  
  138. /* Chain of all CONST_DOUBLEs made for this function;
  139.    so we can uniquize them.  */
  140.  
  141. rtx real_constant_chain;
  142.  
  143. /* rtx gen_rtx (code, mode, [element1, ..., elementn])
  144. **
  145. **        This routine generates an RTX of the size specified by
  146. **    <code>, which is an RTX code.   The RTX structure is initialized
  147. **    from the arguments <element1> through <elementn>, which are
  148. **    interpreted according to the specific RTX type's format.   The
  149. **    special machine mode associated with the rtx (if any) is specified
  150. **    in <mode>.
  151. **
  152. **        gen_rtx() can be invoked in a way which resembles the lisp-like
  153. **    rtx it will generate.   For example, the following rtx structure:
  154. **
  155. **          (plus:QI (mem:QI (reg:SI 1))
  156. **               (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3))))
  157. **
  158. **        ...would be generated by the following C code:
  159. **
  160. **            gen_rtx (PLUS, QImode,
  161. **            gen_rtx (MEM, QImode,
  162. **            gen_rtx (REG, SImode, 1)),
  163. **            gen_rtx (MEM, QImode,
  164. **            gen_rtx (PLUS, SImode,
  165. **                gen_rtx (REG, SImode, 2),
  166. **                gen_rtx (REG, SImode, 3)))),
  167. */
  168.  
  169. /*VARARGS2*/
  170. rtx
  171. gen_rtx (va_alist)
  172.      va_dcl
  173. {
  174.   va_list p;
  175.   enum rtx_code code;
  176.   enum machine_mode mode;
  177.   register char *argp;        /* Pointer to arguments...        */
  178.   register int i;        /* Array indices...            */
  179.   register char *fmt;        /* Current rtx's format...        */
  180.   register rtx rt_val;        /* RTX to return to caller...        */
  181.  
  182.   va_start (p);
  183.   code = va_arg (p, enum rtx_code);
  184.   mode = va_arg (p, enum machine_mode);
  185.  
  186.   if (code == CONST_INT)
  187.     {
  188.       int arg = va_arg (p, int);
  189.       if (arg == 0)
  190.     return const0_rtx;
  191.       if (arg == 1)
  192.     return const1_rtx;
  193.       rt_val = rtx_alloc (code);
  194.       INTVAL (rt_val) = arg;
  195.     }
  196.   else if (code == CONST_DOUBLE)
  197.     {
  198.       int arg0 = va_arg (p, int);
  199.       int arg1 = va_arg (p, int);
  200.       if (arg0 == XINT (fconst0_rtx, 0)
  201.       && arg1 == XINT (fconst0_rtx, 1))
  202.     return (mode == DFmode ? dconst0_rtx : fconst0_rtx);
  203.       rt_val = rtx_alloc (code);
  204.       rt_val->mode = mode;
  205.       XINT (rt_val, 0) = arg0;
  206.       XINT (rt_val, 1) = arg1;
  207.     }
  208.   else
  209.     {
  210.       rt_val = rtx_alloc (code);    /* Allocate the storage space.  */
  211.       rt_val->mode = mode;        /* Store the machine mode...  */
  212.  
  213.       fmt = GET_RTX_FORMAT (code);    /* Find the right format...  */
  214.       for (i = 0; i < GET_RTX_LENGTH (code); i++)
  215.     {
  216.       switch (*fmt++)
  217.         {
  218.         case '0':        /* Unused field.  */
  219.           break;
  220.  
  221.         case 'i':        /* An integer?  */
  222.           XINT (rt_val, i) = va_arg (p, int);
  223.           break;
  224.  
  225.         case 's':        /* A string?  */
  226.           XSTR (rt_val, i) = va_arg (p, char *);
  227.           break;
  228.  
  229.         case 'e':        /* An expression?  */
  230.         case 'u':        /* An insn?  Same except when printing.  */
  231.           XEXP (rt_val, i) = va_arg (p, rtx);
  232.           break;
  233.  
  234.         case 'E':        /* An RTX vector?  */
  235.           XVEC (rt_val, i) = va_arg (p, rtvec);
  236.           break;
  237.  
  238.         default:
  239.           abort();
  240.         }
  241.     }
  242.     }
  243.   va_end (p);
  244.   return rt_val;        /* Return the new RTX...        */
  245. }
  246.  
  247. /* gen_rtvec (n, [rt1, ..., rtn])
  248. **
  249. **        This routine creates an rtvec and stores within it the
  250. **    pointers to rtx's which are its arguments.
  251. */
  252.  
  253. /*VARARGS1*/
  254. rtvec
  255. gen_rtvec (va_alist)
  256.      va_dcl
  257. {
  258.   int n, i;
  259.   rtx first;
  260.   va_list p;
  261.   rtx *vector;
  262.  
  263.   va_start (p);
  264.   n = va_arg (p, int);
  265.  
  266.   if (n == 0)
  267.     return NULL_RTVEC;        /* Don't allocate an empty rtvec...    */
  268.  
  269.   vector = (rtx *) alloca (n * sizeof (rtx));
  270.   for (i = 0; i < n; i++)
  271.     vector[i] = va_arg (p, rtx);
  272.   va_end (p);
  273.  
  274.   return gen_rtvec_v (n, vector);
  275. }
  276.  
  277. rtvec
  278. gen_rtvec_v (n, argp)
  279.      int n;
  280.      rtx *argp;
  281. {
  282.   register int i;
  283.   register rtvec rt_val;
  284.  
  285.   if (n == 0)
  286.     return NULL_RTVEC;        /* Don't allocate an empty rtvec...    */
  287.  
  288.   rt_val = rtvec_alloc (n);    /* Allocate an rtvec...            */
  289.  
  290.   for (i = 0; i < n; i++)
  291.     rt_val->elem[i].rtx = *argp++;
  292.  
  293.   return rt_val;
  294. }
  295.  
  296. /* Generate a REG rtx for a new pseudo register of mode MODE.
  297.    This pseudo is assigned the next sequential register number.  */
  298.  
  299. rtx
  300. gen_reg_rtx (mode)
  301.      enum machine_mode mode;
  302. {
  303.   register rtx val;
  304.  
  305.   /* Make sure regno_pointer_flag and regno_reg_rtx are large
  306.      enough to have an element for this pseudo reg number.  */
  307.  
  308.   if (reg_rtx_no == regno_pointer_flag_length)
  309.     {
  310.       rtx *new1;
  311.       char *new =
  312.     (char *) oballoc (regno_pointer_flag_length * 2);
  313.       bzero (new, regno_pointer_flag_length * 2);
  314.       bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
  315.       regno_pointer_flag = new;
  316.  
  317.       new1 = (rtx *) oballoc (regno_pointer_flag_length * 2 * sizeof (rtx));
  318.       bzero (new1, regno_pointer_flag_length * 2 * sizeof (rtx));
  319.       bcopy (regno_reg_rtx, new1, regno_pointer_flag_length * sizeof (rtx));
  320.       regno_reg_rtx = new1;
  321.  
  322.       regno_pointer_flag_length *= 2;
  323.     }
  324.  
  325.   val = gen_rtx (REG, mode, reg_rtx_no);
  326.   regno_reg_rtx[reg_rtx_no++] = val;
  327.   return val;
  328. }
  329.  
  330. /* Identify REG as a probable pointer register.  */
  331.  
  332. void
  333. mark_reg_pointer (reg)
  334.      rtx reg;
  335. {
  336.   REGNO_POINTER_FLAG (REGNO (reg)) = 1;
  337. }
  338.  
  339. /* Return 1 plus largest pseudo reg number used in the current function.  */
  340.  
  341. int
  342. max_reg_num ()
  343. {
  344.   return reg_rtx_no;
  345. }
  346.  
  347. /* Return 1 + the largest label number used so far.  */
  348.  
  349. int
  350. max_label_num ()
  351. {
  352.   return label_num;
  353. }
  354.  
  355. /* Return first label number used in this function (if any were used).  */
  356.  
  357. int
  358. get_first_label_num ()
  359. {
  360.   return first_label_num;
  361. }
  362.  
  363. /* Assuming that X is an rtx (MEM, REG or SUBREG) for a fixed-point number,
  364.    return a MEM or SUBREG rtx that refers to the least-significant part of X.
  365.    MODE specifies how big a part of X to return;
  366.    it must not be larger than a word.
  367.    If X is a MEM whose address is a QUEUED, the value may be so also.  */
  368.  
  369. rtx
  370. gen_lowpart (mode, x)
  371.      enum machine_mode mode;
  372.      register rtx x;
  373. {
  374.   /* This case loses if X is a subreg.  To catch bugs early,
  375.      complain if an invalid MODE is used even in other cases.  */
  376.   if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
  377.     abort ();
  378.   if (GET_CODE (x) == SUBREG)
  379.     return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0
  380.         ? SUBREG_REG (x)
  381.         : gen_rtx (SUBREG, mode, SUBREG_REG (x), SUBREG_WORD (x)));
  382.   if (GET_MODE (x) == mode)
  383.     return x;
  384.   if (GET_CODE (x) == CONST_INT)
  385.     return gen_rtx (CONST_INT, VOIDmode, INTVAL (x) & GET_MODE_MASK (mode));
  386.   if (GET_CODE (x) == MEM)
  387.     {
  388.       register int offset = 0;
  389. #ifdef WORDS_BIG_ENDIAN
  390.       offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  391.         - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  392. #endif
  393. #ifdef BYTES_BIG_ENDIAN
  394.       /* Adjust the address so that the address-after-the-data
  395.      is unchanged.  */
  396.       offset -= (min (UNITS_PER_WORD, GET_MODE_SIZE (mode))
  397.          - min (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
  398. #endif
  399.       return gen_rtx (MEM, mode,
  400.               memory_address (mode,
  401.                       plus_constant (XEXP (x, 0), offset)));
  402.     }
  403.   else if (GET_CODE (x) == REG)
  404.     {
  405. #ifdef WORDS_BIG_ENDIAN
  406.       if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  407.     {
  408.       return gen_rtx (SUBREG, mode, x,
  409.               ((GET_MODE_SIZE (GET_MODE (x))
  410.                 - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  411.                / UNITS_PER_WORD));
  412.     }
  413. #endif
  414.       return gen_rtx (SUBREG, mode, x, 0);
  415.     }
  416.   else
  417.     abort ();
  418. }
  419.  
  420. /* Like `gen_lowpart', but refer to the most significant part.  */
  421.  
  422. rtx
  423. gen_highpart (mode, x)
  424.      enum machine_mode mode;
  425.      register rtx x;
  426. {
  427.   if (GET_CODE (x) == MEM)
  428.     {
  429.       register int offset = 0;
  430. #ifndef WORDS_BIG_ENDIAN
  431.       offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  432.         - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  433. #endif
  434. #ifndef BYTES_BIG_ENDIAN
  435.       if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
  436.     offset -= (GET_MODE_SIZE (mode)
  437.            - min (UNITS_PER_WORD,
  438.               GET_MODE_SIZE (GET_MODE (x))));
  439. #endif
  440.       return gen_rtx (MEM, mode,
  441.               memory_address (mode,
  442.                       plus_constant (XEXP (x, 0), offset)));
  443.     }
  444.   else if (GET_CODE (x) == REG)
  445.     {
  446. #ifndef WORDS_BIG_ENDIAN
  447.       if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  448.     {
  449.       return gen_rtx (SUBREG, mode, x,
  450.               ((GET_MODE_SIZE (GET_MODE (x))
  451.                 - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  452.                / UNITS_PER_WORD));
  453.     }
  454. #endif
  455.       return gen_rtx (SUBREG, mode, x, 0);
  456.     }
  457.   else
  458.     abort ();
  459. }
  460.  
  461. /* Return 1 iff X, assumed to be a SUBREG,
  462.    refers to the least significant part of its containing reg.
  463.    If X is not a SUBREG, always return 1 (it is its own low part!).  */
  464.  
  465. int
  466. subreg_lowpart_p (x)
  467.      rtx x;
  468. {
  469.   if (GET_CODE (x) != SUBREG)
  470.     return 1;
  471. #ifdef WORDS_BIG_ENDIAN
  472.   if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  473.     {
  474.       register enum machine_mode mode = GET_MODE (SUBREG_REG (x));
  475.       return (SUBREG_WORD (x)
  476.           == ((GET_MODE_SIZE (GET_MODE (x))
  477.            - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  478.           / UNITS_PER_WORD));
  479.     }
  480. #endif 
  481.   return SUBREG_WORD (x) == 0;
  482. }
  483.  
  484. /* Return a memory reference like MEMREF, but with its mode changed
  485.    to MODE and its address changed to ADDR.
  486.    (VOIDmode means don't change the mode.
  487.    NULL for ADDR means don't change the address.)  */
  488.  
  489. rtx
  490. change_address (memref, mode, addr)
  491.      rtx memref;
  492.      enum machine_mode mode;
  493.      rtx addr;
  494. {
  495.   rtx new;
  496.  
  497.   if (mode == VOIDmode)
  498.     mode = GET_MODE (memref);
  499.   if (addr == 0)
  500.     addr = XEXP (memref, 0);
  501.  
  502.   new = gen_rtx (MEM, mode, memory_address (mode, addr));
  503.   new->volatil = memref->volatil;
  504.   new->unchanging = memref->unchanging;
  505.   new->in_struct = memref->in_struct;
  506.   return new;
  507. }
  508.  
  509. /* Return a newly created CODE_LABEL rtx with a unique label number.  */
  510.  
  511. rtx
  512. gen_label_rtx ()
  513. {
  514.   register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++);
  515.   LABEL_NUSES (label) = 0;
  516.   return label;
  517. }
  518.  
  519. /* For procedure integration.  */
  520.  
  521. /* Return a newly created INLINE_HEADER rtx.  Should allocate this
  522.    from a permanent obstack when the opportunity arises.  */
  523.  
  524. rtx
  525. gen_inline_header_rtx (insn, last_insn,
  526.                first_labelno, last_labelno,
  527.                max_parm_regnum, max_regnum, args_size)
  528.      rtx insn, last_insn;
  529.      int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size;
  530. {
  531.   rtx header = gen_rtx (INLINE_HEADER, VOIDmode,
  532.             cur_insn_uid++, NULL,
  533.             insn, last_insn,
  534.             first_labelno, last_labelno,
  535.             max_parm_regnum, max_regnum, args_size);
  536.   return header;
  537. }
  538.  
  539. /* Install new pointers to the first and last insns in the chain.
  540.    Used for an inline-procedure after copying the insn chain.  */
  541.  
  542. void
  543. set_new_first_and_last_insn (first, last)
  544.      rtx first, last;
  545. {
  546.   first_insn = first;
  547.   last_insn = last;
  548. }
  549.  
  550. /* Go through all the RTL insn bodies and copy any invalid shared structure.
  551.    It does not work to do this twice, because the mark bits set here
  552.    are not cleared afterwards.  */
  553.  
  554. static int unshare_copies = 0;    /* Count rtx's that were copied.  */
  555.  
  556. static rtx copy_rtx_if_shared ();
  557.  
  558. void
  559. unshare_all_rtl (insn)
  560.      register rtx insn;
  561. {
  562.   for (; insn; insn = NEXT_INSN (insn))
  563.     if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
  564.     || GET_CODE (insn) == CALL_INSN)
  565.       {
  566.     rtx tail;
  567.     PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn));
  568.     /* Copy the contents of the reg-notes */
  569.     for (tail = REG_NOTES (insn); tail; tail = XEXP (tail, 1))
  570.       /* But if contents are an insn, don't copy that.  */
  571.       if (GET_CODE (tail) == EXPR_LIST)
  572.         XEXP (tail, 0) = copy_rtx_if_shared (XEXP (tail, 0));
  573.       }
  574. }
  575.  
  576. /* Mark ORIG as in use, and return a copy of it if it was already in use.
  577.    Recursively does the same for subexpressions.  */
  578.  
  579. static rtx
  580. copy_rtx_if_shared (orig)
  581.      rtx orig;
  582. {
  583.   register rtx x = orig;
  584.   register int i;
  585.   register enum rtx_code code;
  586.   register char *format_ptr;
  587.   int copied = 0;
  588.  
  589.   code = GET_CODE (x);
  590.  
  591.   /* These types may be freely shared.  */
  592.  
  593.   switch (code)
  594.     {
  595.     case REG:
  596.     case QUEUED:
  597.     case CONST_INT:
  598.     case CONST_DOUBLE:
  599.     case SYMBOL_REF:
  600.     case CODE_LABEL:
  601.     case PC:
  602.     case CC0:
  603.       return x;
  604.  
  605.     case MEM:
  606.       /* A MEM is allowed to be shared if its address is constant
  607.      or is a constant plus one of the special registers.  */
  608.       if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
  609.     return x;
  610.       if (GET_CODE (XEXP (x, 0)) == PLUS
  611.       && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
  612.       && (REGNO (XEXP (XEXP (x, 0), 0)) == FRAME_POINTER_REGNUM
  613.           || REGNO (XEXP (XEXP (x, 0), 0)) == ARG_POINTER_REGNUM)
  614.       && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
  615.       if (GET_CODE (XEXP (x, 0)) == REG
  616.       && (REGNO (XEXP (x, 0)) == FRAME_POINTER_REGNUM
  617.           || REGNO (XEXP (x, 0)) == ARG_POINTER_REGNUM)
  618.       && CONSTANT_ADDRESS_P (XEXP (x, 1)))
  619.     return x;
  620.     }
  621.  
  622.   /* This rtx may not be shared.  If it has already been seen,
  623.      replace it with a copy of itself.  */
  624.  
  625.   if (x->used)
  626.     {
  627.       register rtx copy;
  628.  
  629.       unshare_copies++;
  630.  
  631.       copy = rtx_alloc (code);
  632.       bcopy (x, copy, sizeof (int) * (GET_RTX_LENGTH (code) + 1));
  633.       x = copy;
  634.       copied = 1;
  635.     }
  636.   x->used = 1;
  637.  
  638.   /* Now scan the subexpressions recursively.
  639.      We can store any replaced subexpressions directly into X
  640.      since we know X is not shared!  Any vectors in X
  641.      must be copied if X was copied.  */
  642.  
  643.   format_ptr = GET_RTX_FORMAT (code);
  644.  
  645.   for (i = 0; i < GET_RTX_LENGTH (code); i++)
  646.     {
  647.       switch (*format_ptr++)
  648.     {
  649.     case 'e':
  650.       XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i));
  651.       break;
  652.  
  653.     case 'E':
  654.       if (XVEC (x, i) != NULL)
  655.         {
  656.           register int j;
  657.  
  658.           if (copied)
  659.         XVEC (x, i) = gen_rtvec_v (XVECLEN (x, i), &XVECEXP (x, i, 0));
  660.           for (j = 0; j < XVECLEN (x, i); j++)
  661.         XVECEXP (x, i, j)
  662.           = copy_rtx_if_shared (XVECEXP (x, i, j));
  663.         }
  664.       break;
  665.     }
  666.     }
  667.   return x;
  668. }
  669.  
  670. /* Copy X if necessary so that it won't be altered by changes in OTHER.
  671.    Return X or the rtx for the pseudo reg the value of X was copied into.
  672.    OTHER must be valid as a SET_DEST.  */
  673.  
  674. rtx
  675. make_safe_from (x, other)
  676.      rtx x, other;
  677. {
  678.   rtx out = other;
  679.   while (1)
  680.     switch (GET_CODE (other))
  681.       {
  682.       case SUBREG:
  683.     other = SUBREG_REG (other);
  684.     break;
  685.       case STRICT_LOW_PART:
  686.       case SIGN_EXTEND:
  687.       case ZERO_EXTEND:
  688.     other = XEXP (other, 0);
  689.     break;
  690.       default:
  691.     goto done;
  692.       }
  693.  done:
  694.   if ((GET_CODE (other) == MEM
  695.        && ! CONSTANT_P (x)
  696.        && GET_CODE (x) != CONST_DOUBLE
  697.        && GET_CODE (x) != REG)
  698.       || (GET_CODE (other) == REG
  699.       && (REGNO (other) < FIRST_PSEUDO_REGISTER
  700.           || reg_mentioned_p (other, x))))
  701.     {
  702.       rtx temp = gen_reg_rtx (GET_MODE (x));
  703.       emit_move_insn (temp, x);
  704.       return temp;
  705.     }
  706.   return x;
  707. }
  708.  
  709. /* Emission of insns (adding them to the doubly-linked list).  */
  710.  
  711. /* Return the first insn of the current function.  */
  712.  
  713. rtx
  714. get_insns ()
  715. {
  716.   return first_insn;
  717. }
  718.  
  719. /* Return the last insn of the current function.  */
  720.  
  721. rtx
  722. get_last_insn ()
  723. {
  724.   return last_insn;
  725. }
  726.  
  727. /* Return a number larger than any instruction's uid in this function.  */
  728.  
  729. int
  730. get_max_uid ()
  731. {
  732.   return cur_insn_uid;
  733. }
  734.  
  735. /* Make and return an INSN rtx, initializing all its slots.
  736.    Store PATTERN in the pattern slots.
  737.    PAT_FORMALS is an idea that never really went anywhere.  */
  738.  
  739. static rtx
  740. make_insn_raw (pattern, pat_formals)
  741.      rtx pattern;
  742.      rtvec pat_formals;
  743. {
  744.   register rtx insn;
  745.  
  746.   insn = rtx_alloc(INSN);
  747.   INSN_UID(insn) = cur_insn_uid++;
  748.  
  749.   PATTERN (insn) = pattern;
  750.   INSN_CODE (insn) = -1;
  751.   LOG_LINKS(insn) = NULL;
  752.   REG_NOTES(insn) = NULL;
  753.  
  754.   return insn;
  755. }
  756.  
  757. /* Like `make_insn' but make a JUMP_INSN instead of an insn.  */
  758.  
  759. static rtx
  760. make_jump_insn_raw (pattern, pat_formals)
  761.      rtx pattern;
  762.      rtvec pat_formals;
  763. {
  764.   register rtx insn;
  765.  
  766.   insn = rtx_alloc(JUMP_INSN);
  767.   INSN_UID(insn) = cur_insn_uid++;
  768.  
  769.   PATTERN (insn) = pattern;
  770.   INSN_CODE (insn) = -1;
  771.   LOG_LINKS(insn) = NULL;
  772.   REG_NOTES(insn) = NULL;
  773.   JUMP_LABEL(insn) = NULL;
  774.  
  775.   return insn;
  776. }
  777.  
  778. /* Add INSN to the end of the doubly-linked list.
  779.    INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE.  */
  780.  
  781. static void
  782. add_insn (insn)
  783.      register rtx insn;
  784. {
  785.   if (emit_to_sequence)
  786.     {
  787.       PREV_INSN (insn) = sequence_last_insn;
  788.       NEXT_INSN (insn) = 0;
  789.  
  790.       if (NULL != sequence_last_insn)
  791.     NEXT_INSN (sequence_last_insn) = insn;
  792.  
  793.       if (NULL == sequence_first_insn)
  794.     sequence_first_insn = insn;
  795.  
  796.       sequence_last_insn = insn;
  797.     }
  798.   else
  799.     {
  800.       PREV_INSN (insn) = last_insn;
  801.       NEXT_INSN (insn) = 0;
  802.  
  803.       if (NULL != last_insn)
  804.     NEXT_INSN (last_insn) = insn;
  805.  
  806.       if (NULL == first_insn)
  807.     first_insn = insn;
  808.  
  809.       last_insn = insn;
  810.     }
  811. }
  812.  
  813. /* Add INSN, an rtx of code INSN, into the doubly-linked list
  814.    after insn AFTER.  */
  815.  
  816. static void
  817. add_insn_after (insn, after)
  818.      rtx insn, after;
  819. {
  820.   NEXT_INSN (insn) = NEXT_INSN (after);
  821.   PREV_INSN (insn) = after;
  822.  
  823.   if (NEXT_INSN (insn))
  824.     PREV_INSN (NEXT_INSN (insn)) = insn;
  825.   else
  826.     last_insn = insn;
  827.   NEXT_INSN (after) = insn;
  828. }
  829.  
  830. /* Delete all insns made since FROM.
  831.    FROM becomes the new last instruction.  */
  832.  
  833. void
  834. delete_insns_since (from)
  835.      rtx from;
  836. {
  837.   NEXT_INSN (from) = 0;
  838.   last_insn = from;
  839. }
  840.  
  841. /* Move a consecutive bunch of insns to a different place in the chain.
  842.    The insns to be moved are those between FROM and TO.
  843.    They are moved to a new position after the insn AFTER.  */
  844.  
  845. void
  846. reorder_insns (from, to, after)
  847.      rtx from, to, after;
  848. {
  849.   /* Splice this bunch out of where it is now.  */
  850.   if (PREV_INSN (from))
  851.     NEXT_INSN (PREV_INSN (from)) = NEXT_INSN (to);
  852.   if (NEXT_INSN (to))
  853.     PREV_INSN (NEXT_INSN (to)) = PREV_INSN (from);
  854.   if (last_insn == to)
  855.     last_insn = PREV_INSN (from);
  856.   if (first_insn == from)
  857.     first_insn = NEXT_INSN (to);
  858.  
  859.   /* Make the new neighbors point to it and it to them.  */
  860.   if (NEXT_INSN (after))
  861.     {
  862.       PREV_INSN (NEXT_INSN (after)) = to;
  863.       NEXT_INSN (to) = NEXT_INSN (after);
  864.     }
  865.   PREV_INSN (from) = after;
  866.   NEXT_INSN (after) = from;
  867.   if (after == last_insn)
  868.     last_insn = to;
  869. }
  870.  
  871. /* Emit an insn of given code and pattern
  872.    at a specified place within the doubly-linked list.  */
  873.  
  874. /* Make an instruction with body PATTERN
  875.    and output it before the instruction BEFORE.  */
  876.  
  877. rtx
  878. emit_insn_before (pattern, before)
  879.      register rtx pattern, before;
  880. {
  881.   register rtx insn;
  882.  
  883.   if (GET_CODE (pattern) == SEQUENCE)
  884.     {
  885.       register int i;
  886.       /* For an empty sequence, emit nothing.  */
  887.       if (XVEC (pattern, 0))
  888.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  889.       add_insn_after (XVECEXP (pattern, 0, i), PREV_INSN (before));
  890.       return PREV_INSN (before);
  891.     }
  892.  
  893.   insn = make_insn_raw (pattern, 0);
  894.  
  895.   PREV_INSN (insn) = PREV_INSN (before);
  896.   NEXT_INSN (insn) = before;
  897.  
  898.   if (PREV_INSN (insn))
  899.     NEXT_INSN (PREV_INSN (insn)) = insn;
  900.   else
  901.     first_insn = insn;
  902.   PREV_INSN (before) = insn;
  903.  
  904.   return insn;
  905. }
  906.  
  907. /* Make an instruction with body PATTERN and code JUMP_INSN
  908.    and output it before the instruction BEFORE.  */
  909.  
  910. rtx
  911. emit_jump_insn_before (pattern, before)
  912.      register rtx pattern, before;
  913. {
  914.   register rtx insn = make_jump_insn_raw (pattern, 0);
  915.  
  916.   PREV_INSN (insn) = PREV_INSN (before);
  917.   NEXT_INSN (insn) = before;
  918.  
  919.   if (PREV_INSN (insn))
  920.     NEXT_INSN (PREV_INSN (insn)) = insn;
  921.   else
  922.     first_insn = insn;
  923.   PREV_INSN (before) = insn;
  924.  
  925.   return insn;
  926. }
  927.  
  928. /* Make an insn of code INSN with body PATTERN
  929.    and output it after the insn AFTER.  */
  930.  
  931. rtx
  932. emit_insn_after (pattern, after)
  933.      register rtx pattern, after;
  934. {
  935.   if (GET_CODE (pattern) == SEQUENCE)
  936.     {
  937.       register int i;
  938.       /* For an empty sequence, emit nothing.  */
  939.       if (XVEC (pattern, 0))
  940.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  941.       {
  942.         add_insn_after (XVECEXP (pattern, 0, i), after);
  943.         after = NEXT_INSN (after);
  944.       }
  945.       return after;
  946.     }
  947.   else
  948.     {
  949.       register rtx insn = make_insn_raw (pattern, 0);
  950.       add_insn_after (insn, after);
  951.       return insn;
  952.     }
  953. }
  954.  
  955. /* Make an insn of code JUMP_INSN with body PATTERN
  956.    and output it after the insn AFTER.  */
  957.  
  958. rtx
  959. emit_jump_insn_after (pattern, after)
  960.      register rtx pattern, after;
  961. {
  962.   register rtx insn = make_jump_insn_raw (pattern, 0);
  963.  
  964.   add_insn_after (insn, after);
  965.   return insn;
  966. }
  967.  
  968. /* Make an insn of code BARRIER
  969.    and output it after the insn AFTER.  */
  970.  
  971. rtx
  972. emit_barrier_after (after)
  973.      register rtx after;
  974. {
  975.   register rtx insn = rtx_alloc (BARRIER);
  976.  
  977.   INSN_UID (insn) = cur_insn_uid++;
  978.  
  979.   add_insn_after (insn, after);
  980.   return insn;
  981. }
  982.  
  983. /* Emit the label LABEL after the insn AFTER.  */
  984.  
  985. void
  986. emit_label_after (label, after)
  987.      rtx label, after;
  988. {
  989.   /* This can be called twice for the same label
  990.      as a result of the confusion that follows a syntax error!
  991.      So make it harmless.  */
  992.   if (INSN_UID (label) == 0)
  993.     {
  994.       INSN_UID (label) = cur_insn_uid++;
  995.       add_insn_after (label, after);
  996.     }
  997. }
  998.  
  999. /* Emit a note of subtype SUBTYPE after the insn AFTER.  */
  1000.  
  1001. void
  1002. emit_note_after (subtype, after)
  1003.      int subtype;
  1004.      rtx after;
  1005. {
  1006.   register rtx note = rtx_alloc (NOTE);
  1007.   INSN_UID (note) = cur_insn_uid++;
  1008.   XSTR (note, 3) = 0;
  1009.   XINT (note, 4) = subtype;
  1010.   add_insn_after (note, after);
  1011. }
  1012.  
  1013. /* Make an insn of code INSN with pattern PATTERN
  1014.    and add it to the end of the doubly-linked list.
  1015.    If PATTERN is a SEQUENCE, take the elements of it
  1016.    and emit an insn for each element.
  1017.  
  1018.    Returns the last insn emitted.  */
  1019.  
  1020. rtx
  1021. emit_insn (pattern)
  1022.      rtx pattern;
  1023. {
  1024.   rtx insn;
  1025.  
  1026.   if (GET_CODE (pattern) == SEQUENCE)
  1027.     {
  1028.       register int i;
  1029.       /* For an empty sequence, emit nothing.  */
  1030.       if (XVEC (pattern, 0))
  1031.     for (i = 0; i < XVECLEN (pattern, 0); i++)
  1032.       add_insn (insn = XVECEXP (pattern, 0, i));
  1033.     }
  1034.   else
  1035.     {
  1036.       insn = make_insn_raw (pattern, NULL);
  1037.       add_insn (insn);
  1038.     }
  1039.   return insn;
  1040. }
  1041.  
  1042. /* Make an insn of code JUMP_INSN with pattern PATTERN
  1043.    and add it to the end of the doubly-linked list.  */
  1044.  
  1045. rtx
  1046. emit_jump_insn (pattern)
  1047.      rtx pattern;
  1048. {
  1049.   if (GET_CODE (pattern) == SEQUENCE)
  1050.     return emit_insn (pattern);
  1051.   else
  1052.     {
  1053.       register rtx insn = make_jump_insn_raw (pattern, NULL);
  1054.       add_insn (insn);
  1055.       return insn;
  1056.     }
  1057. }
  1058.  
  1059. /* Make an insn of code CALL_INSN with pattern PATTERN
  1060.    and add it to the end of the doubly-linked list.  */
  1061.  
  1062. rtx
  1063. emit_call_insn (pattern)
  1064.      rtx pattern;
  1065. {
  1066.   if (GET_CODE (pattern) == SEQUENCE)
  1067.     return emit_insn (pattern);
  1068.   else
  1069.     {
  1070.       register rtx insn = make_insn_raw (pattern, NULL);
  1071.       add_insn (insn);
  1072.       PUT_CODE (insn, CALL_INSN);
  1073.       return insn;
  1074.     }
  1075. }
  1076.  
  1077. /* Add the label LABEL to the end of the doubly-linked list.  */
  1078.  
  1079. void
  1080. emit_label (label)
  1081.      rtx label;
  1082. {
  1083.   /* This can be called twice for the same label
  1084.      as a result of the confusion that follows a syntax error!
  1085.      So make it harmless.  */
  1086.   if (INSN_UID (label) == 0)
  1087.     {
  1088.       INSN_UID (label) = cur_insn_uid++;
  1089.       add_insn (label);
  1090.     }
  1091. }
  1092.  
  1093. /* Make an insn of code BARRIER
  1094.    and add it to the end of the doubly-linked list.  */
  1095.  
  1096. void
  1097. emit_barrier ()
  1098. {
  1099.   register rtx barrier = rtx_alloc (BARRIER);
  1100.   INSN_UID (barrier) = cur_insn_uid++;
  1101.   add_insn (barrier);
  1102. }
  1103.  
  1104. /* Make an insn of code NOTE
  1105.    with data-fields specified by FILE and LINE
  1106.    and add it to the end of the doubly-linked list.  */
  1107.  
  1108. rtx
  1109. emit_note (file, line)
  1110.      char *file;
  1111.      int line;
  1112. {
  1113.   register rtx note;
  1114.  
  1115.   if (no_line_numbers && line > 0)
  1116.     return 0;
  1117.  
  1118.   if (line > 0)
  1119.     {
  1120.       if (file && last_filename && !strcmp (file, last_filename)
  1121.       && line == last_linenum)
  1122.     return 0;
  1123.       last_filename = file;
  1124.       last_linenum = line;
  1125.     }
  1126.  
  1127.   note = rtx_alloc (NOTE);
  1128.   INSN_UID (note) = cur_insn_uid++;
  1129.   XSTR (note, 3) = file;
  1130.   XINT (note, 4) = line;
  1131.   add_insn (note);
  1132.   return note;
  1133. }
  1134.  
  1135. /* Return an indication of which type of insn should have X as a body.
  1136.    The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN.  */
  1137.  
  1138. enum rtx_code
  1139. classify_insn (x)
  1140.      rtx x;
  1141. {
  1142.   if (GET_CODE (x) == CODE_LABEL)
  1143.     return CODE_LABEL;
  1144.   if (GET_CODE (x) == CALL)
  1145.     return CALL_INSN;
  1146.   if (GET_CODE (x) == RETURN)
  1147.     return JUMP_INSN;
  1148.   if (GET_CODE (x) == SET)
  1149.     {
  1150.       if (SET_DEST (x) == pc_rtx)
  1151.     return JUMP_INSN;
  1152.       else if (GET_CODE (SET_SRC (x)) == CALL)
  1153.     return CALL_INSN;
  1154.       else
  1155.     return INSN;
  1156.     }
  1157.   if (GET_CODE (x) == PARALLEL)
  1158.     {
  1159.       register int j;
  1160.       for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
  1161.     if (GET_CODE (XVECEXP (x, 0, j)) == CALL)
  1162.       return CALL_INSN;
  1163.     else if (GET_CODE (XVECEXP (x, 0, j)) == SET
  1164.          && SET_DEST (XVECEXP (x, 0, j)) == pc_rtx)
  1165.       return JUMP_INSN;
  1166.     else if (GET_CODE (XVECEXP (x, 0, j)) == SET
  1167.          && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL)
  1168.       return CALL_INSN;
  1169.     }
  1170.   return INSN;
  1171. }
  1172.  
  1173. /* Emit the rtl pattern X as an appropriate kind of insn.
  1174.    If X is a label, it is simply added into the insn chain.  */
  1175.  
  1176. rtx
  1177. emit (x)
  1178.      rtx x;
  1179. {
  1180.   enum rtx_code code = classify_insn (x);
  1181.  
  1182.   if (code == CODE_LABEL)
  1183.     emit_label (x);
  1184.   else if (code == INSN)
  1185.     emit_insn (x);
  1186.   else if (code == JUMP_INSN)
  1187.     {
  1188.       emit_jump_insn (x);
  1189.       if (simplejump_p (x) || GET_CODE (x) == RETURN)
  1190.     emit_barrier ();
  1191.     }
  1192.   else if (code == CALL_INSN)
  1193.     emit_call_insn (x);
  1194. }
  1195.  
  1196. /* Generate a SEQUENCE rtx containing the insn-patterns in VEC
  1197.    following any insns previously placed on sequence_first_insn.
  1198.    This is how the gen_... function from a DEFINE_EXPAND
  1199.    constructs the SEQUENCE that it returns.  */
  1200.  
  1201. rtx
  1202. gen_sequence ()
  1203. {
  1204.   rtx tem;
  1205.   rtvec newvec;
  1206.   int i;
  1207.   int len;
  1208.  
  1209.   /* Count the insns in the chain.  */
  1210.   len = 0;
  1211.   for (tem = sequence_first_insn; tem; tem = NEXT_INSN (tem))
  1212.     len++;
  1213.  
  1214.   /* For an empty sequence... */
  1215.   if (len == 0)
  1216.     return gen_rtx (SEQUENCE, VOIDmode, NULL);
  1217.  
  1218.   /* If only one insn, return its pattern rather than a SEQUENCE.  */
  1219.   if (len == 1
  1220.       && (GET_CODE (sequence_first_insn) == INSN
  1221.       || GET_CODE (sequence_first_insn) == JUMP_INSN
  1222.       || GET_CODE (sequence_first_insn) == CALL_INSN))
  1223.     {
  1224.       tem = PATTERN (sequence_first_insn);
  1225.       sequence_first_insn = 0;
  1226.       sequence_last_insn = 0;
  1227.       return tem;
  1228.     }
  1229.  
  1230.   /* Put them in a vector.  */
  1231.   newvec = rtvec_alloc (len);
  1232.   i = 0;
  1233.   for (tem = sequence_first_insn; tem; tem = NEXT_INSN (tem), i++)
  1234.     newvec->elem[i].rtx = tem;
  1235.  
  1236.   /* Clear the chain and make a SEQUENCE from this vector.  */
  1237.   sequence_first_insn = 0;
  1238.   sequence_last_insn = 0;
  1239.   return gen_rtx (SEQUENCE, VOIDmode, newvec);
  1240. }
  1241.  
  1242. /* Set up regno_reg_rtx, reg_rtx_no and regno_pointer_flag
  1243.    according to the chain of insns starting with FIRST.
  1244.  
  1245.    Also set cur_insn_uid to exceed the largest uid in that chain.
  1246.  
  1247.    This is used when an inline function's rtl is saved
  1248.    and passed to rest_of_compilation later.  */
  1249.  
  1250. static void restore_reg_data_1 ();
  1251.  
  1252. void
  1253. restore_reg_data (first)
  1254.      rtx first;
  1255. {
  1256.   register rtx insn;
  1257.   int i;
  1258.   register int max_uid = 0;
  1259.  
  1260.   for (insn = first; insn; insn = NEXT_INSN (insn))
  1261.     {
  1262.       if (INSN_UID (insn) >= max_uid)
  1263.     max_uid = INSN_UID (insn);
  1264.  
  1265.       switch (GET_CODE (insn))
  1266.     {
  1267.     case NOTE:
  1268.     case CODE_LABEL:
  1269.     case BARRIER:
  1270.       break;
  1271.  
  1272.     case JUMP_INSN:
  1273.     case CALL_INSN:
  1274.     case INSN:
  1275.       restore_reg_data_1 (PATTERN (insn));
  1276.       break;
  1277.     }
  1278.     }
  1279.  
  1280.   /* Don't duplicate the uids already in use.  */
  1281.   cur_insn_uid = max_uid + 1;
  1282.  
  1283.   /* If any regs are missing, make them up.  */
  1284.   for (i = FIRST_PSEUDO_REGISTER; i < reg_rtx_no; i++)
  1285.     if (regno_reg_rtx[i] == 0)
  1286.       regno_reg_rtx[i] = gen_rtx (REG, SImode, i);
  1287. }
  1288.  
  1289. static void
  1290. restore_reg_data_1 (orig)
  1291.      rtx orig;
  1292. {
  1293.   register rtx x = orig;
  1294.   register int i;
  1295.   register enum rtx_code code;
  1296.   register char *format_ptr;
  1297.  
  1298.   code = GET_CODE (x);
  1299.  
  1300.   switch (code)
  1301.     {
  1302.     case QUEUED:
  1303.     case CONST_INT:
  1304.     case CONST_DOUBLE:
  1305.     case SYMBOL_REF:
  1306.     case CODE_LABEL:
  1307.     case PC:
  1308.     case CC0:
  1309.     case LABEL_REF:
  1310.       return;
  1311.  
  1312.     case REG:
  1313.       if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
  1314.     {
  1315.       /* Make sure regno_pointer_flag and regno_reg_rtx are large
  1316.          enough to have an element for this pseudo reg number.  */
  1317.       if (REGNO (x) >= reg_rtx_no)
  1318.         {
  1319.           reg_rtx_no = REGNO (x);
  1320.  
  1321.           if (reg_rtx_no == regno_pointer_flag_length)
  1322.         {
  1323.           rtx *new1;
  1324.           char *new =
  1325.             (char *) oballoc (regno_pointer_flag_length * 2);
  1326.           bzero (new, regno_pointer_flag_length * 2);
  1327.           bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
  1328.           regno_pointer_flag = new;
  1329.  
  1330.           new1 = (rtx *) oballoc (regno_pointer_flag_length * 2 * sizeof (rtx));
  1331.           bzero (new1, regno_pointer_flag_length * 2 * sizeof (rtx));
  1332.           bcopy (regno_reg_rtx, new1, regno_pointer_flag_length * sizeof (rtx));
  1333.           regno_reg_rtx = new1;
  1334.  
  1335.           regno_pointer_flag_length *= 2;
  1336.         }
  1337.           reg_rtx_no ++;
  1338.         }
  1339.       regno_reg_rtx[REGNO (x)] = x;
  1340.     }
  1341.       return;
  1342.  
  1343.     case MEM:
  1344.       restore_reg_data_1 (XEXP (x, 0));
  1345.       return;
  1346.     }
  1347.  
  1348.   /* Now scan the subexpressions recursively.  */
  1349.  
  1350.   format_ptr = GET_RTX_FORMAT (code);
  1351.  
  1352.   for (i = 0; i < GET_RTX_LENGTH (code); i++)
  1353.     {
  1354.       switch (*format_ptr++)
  1355.     {
  1356.     case 'e':
  1357.       restore_reg_data_1 (XEXP (x, i));
  1358.       break;
  1359.  
  1360.     case 'E':
  1361.       if (XVEC (x, i) != NULL)
  1362.         {
  1363.           register int j;
  1364.  
  1365.           for (j = 0; j < XVECLEN (x, i); j++)
  1366.         restore_reg_data_1 (XVECEXP (x, i, j));
  1367.         }
  1368.       break;
  1369.     }
  1370.     }
  1371. }
  1372.  
  1373. /* Initialize data structures and variables in this file
  1374.    before generating rtl for each function.
  1375.    WRITE_SYMBOLS is nonzero if any kind of debugging info
  1376.    is to be generated.  */
  1377.  
  1378. void
  1379. init_emit (write_symbols)
  1380.      int write_symbols;
  1381. {
  1382.   first_insn = NULL;
  1383.   last_insn = NULL;
  1384.   cur_insn_uid = 1;
  1385.   reg_rtx_no = FIRST_PSEUDO_REGISTER;
  1386.   last_linenum = 0;
  1387.   last_filename = 0;
  1388.   real_constant_chain = 0;
  1389.   first_label_num = label_num;
  1390.   sequence_first_insn = NULL;
  1391.   sequence_last_insn = NULL;
  1392.   emit_to_sequence = 0;
  1393.  
  1394.   no_line_numbers = ! write_symbols;
  1395.   
  1396.   /* Init the tables that describe all the pseudo regs.  */
  1397.  
  1398.   regno_pointer_flag_length = 100;
  1399.  
  1400.   regno_pointer_flag 
  1401.     = (char *) oballoc (regno_pointer_flag_length);
  1402.   bzero (regno_pointer_flag, regno_pointer_flag_length);
  1403.  
  1404.   regno_reg_rtx 
  1405.     = (rtx *) oballoc (regno_pointer_flag_length * sizeof (rtx));
  1406.   bzero (regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx));
  1407. }
  1408.  
  1409. /* Create some permanent unique rtl objects shared between all functions.  */
  1410.  
  1411. void
  1412. init_emit_once ()
  1413. {
  1414.   /* Create the unique rtx's for certain rtx codes and operand values.  */
  1415.  
  1416.   pc_rtx = gen_rtx (PC, VOIDmode);
  1417.   cc0_rtx = gen_rtx (CC0, VOIDmode);
  1418.  
  1419.   /* Don't use gen_rtx here since gen_rtx in this case
  1420.      tries to use these variables.  */
  1421.   const0_rtx = rtx_alloc (CONST_INT);
  1422.   INTVAL (const0_rtx) = 0;
  1423.   const1_rtx = rtx_alloc (CONST_INT);
  1424.   INTVAL (const1_rtx) = 1;
  1425.  
  1426.   fconst0_rtx = rtx_alloc (CONST_DOUBLE);
  1427.   {
  1428.     union { double d; int i[2]; } u;
  1429.     u.d = 0;
  1430.     XINT (fconst0_rtx, 0) = u.i[0];
  1431.     XINT (fconst0_rtx, 1) = u.i[1];
  1432.     XEXP (fconst0_rtx, 2) = const0_rtx;
  1433.   }
  1434.   PUT_MODE (fconst0_rtx, SFmode);
  1435.  
  1436.   dconst0_rtx = rtx_alloc (CONST_DOUBLE);
  1437.   {
  1438.     union { double d; int i[2]; } u;
  1439.     u.d = 0;
  1440.     XINT (dconst0_rtx, 0) = u.i[0];
  1441.     XINT (dconst0_rtx, 1) = u.i[1];
  1442.     XEXP (dconst0_rtx, 2) = const0_rtx;
  1443.   }
  1444.   PUT_MODE (dconst0_rtx, DFmode);
  1445.  
  1446.   stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
  1447.   frame_pointer_rtx = gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM);
  1448.   struct_value_rtx = gen_rtx (REG, Pmode, STRUCT_VALUE_REGNUM);
  1449.  
  1450. #ifdef STRUCT_VALUE_INCOMING_REGNUM
  1451.   if (STRUCT_VALUE_INCOMING_REGNUM != STRUCT_VALUE_REGNUM)
  1452.     struct_value_incoming_rtx = gen_rtx (REG, Pmode, STRUCT_VALUE_INCOMING_REGNUM);
  1453.   else
  1454. #endif
  1455.     struct_value_incoming_rtx = struct_value_rtx;
  1456.  
  1457.   static_chain_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
  1458.  
  1459. #ifdef STATIC_CHAIN_INCOMING_REGNUM
  1460.   if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM)
  1461.     static_chain_incoming_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_INCOMING_REGNUM);
  1462.   else
  1463. #endif
  1464.     static_chain_incoming_rtx = static_chain_rtx;
  1465.  
  1466.   if (FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
  1467.     arg_pointer_rtx = frame_pointer_rtx;
  1468.   else
  1469.     arg_pointer_rtx = gen_rtx (REG, Pmode, ARG_POINTER_REGNUM);
  1470. }
  1471.